public class main3 {
    public static void main(String[] args) {
        int i=2,jishu,j,k=0;
        while(i<20000)
        {
            jishu=0;
            j=2;
            while(j<=i/2)
            {
                if(i%j==0) {
                    jishu++;
                }
                j++;
            }
            if(jishu==0)
            {
                System.out.print(i+" ");
                k++;
                if(k%5==0) {
                    System.out.println("\n");
                }
            }
            i++;
        }
    }
}
